CMAKE_MINIMUM_REQUIRED(VERSION 3.10)

PROJECT(
    blank
    VERSION 0.0.1
    LANGUAGES C)

INCLUDE(ExternalProject)

EXTERNALPROJECT_ADD(
    cimplog
    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/third-party/cimplog
    GIT_REPOSITORY git@gitee.com:third_party_2/cimplog.git
    GIT_TAG "1.0.1"
    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR} -DBUILD_TESTING=OFF -DLEVEL_DEFAULT=2)
ADD_LIBRARY(libcimplog STATIC IMPORTED)
SET_TARGET_PROPERTIES(libcimplog PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lib/libcimplog.a")
ADD_DEPENDENCIES(libcimplog cimplog)

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

AUX_SOURCE_DIRECTORY(src SRC_LIST)

ADD_EXECUTABLE(${PROJECT_NAME} ${SRC_LIST})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC include ${CMAKE_CURRENT_BINARY_DIR}/include)
TARGET_LINK_DIRECTORIES(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/lib)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} libcimplog)
